package com.yanqu.road.server.cmd.activity.bulletscreen;

import com.yanqu.road.pb.activity.BulletScreenProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.activity.bulletscreen.BulletScreenModule;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.GameProtocol;

@Cmd(code = GameProtocol.S_ACTIVITY_BULLET_SCREEN_COMMENTS_FROM_CROSS, desc = "弹幕")
public class BulletScreenContentCmdFromCross extends AbstractCommand {

    int activityId;
    int crossRet;
    BulletScreenProto.ActivityBarrageMessageTemp messageTemp;
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        BulletScreenProto.CrossBulletScreenContentRespMsg respMsg = BulletScreenProto.CrossBulletScreenContentRespMsg.parseFrom(packet.getBytes());
        activityId = respMsg.getActivityId();
        crossRet = respMsg.getRet();
        messageTemp = respMsg.getMsg();
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        player.getModule(BulletScreenModule.class).bulletScreenFromCross(activityId, crossRet, messageTemp);
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
